/**
 * typeof instanceof
 */

const isObject = val => val !== null && typeof val === 'object';

const isArray = Array.isArray

const isMap = val => ToString(val) === '[object Map]'
const isSet = val => ToString(val) === '[object Set]'

const isDate = val => val instanceof Date;

const isString = val => typeof val === 'string';
const isFunction = val => typeof val === 'function';
const isSymbol = val => typeof val === 'symbol';

const object2String = Object.prototype.toString;

/**
 *
 * @param {Promise}  val promise对象
 * @returns {Boolean} 是否是一个Promise对象
 */
const isPromise = val => isObject(val) && isFunction(val.then) && isFunction(val.catch)


const p = new Promise((resolve, reject) => { })
console.log('isAPromise', isObject(p), isPromise(p));

console.log(typeof p);
